# -*- coding:utf-8 -*-
from common.import_pyside import *
from common.data import DB


class PopupWindow(QDialog):
    def __init__(self):
        super(PopupWindow, self).__init__()
        self.setFixedSize(200, 100)
        self.setWindowTitle("任务名称")
        h_layout = QVBoxLayout()
        label_title = QLabel("当前任务名称：")
        self.case_task_name_line_edit = QLineEdit()
        self.case_task_name_line_edit.setPlaceholderText("请输入任务名称！")
        self.case_task_name = self.case_task_name_line_edit.text()
        print(self.case_task_name_line_edit.text())
        self.case_task_name_line_edit.setFocus()
        self.case_task_name_line_edit.setMaxLength(100)
        push_button = QPushButton("开始录制")
        push_button.clicked.connect(self.do_push_button)
        h_layout.addWidget(label_title)
        h_layout.addWidget(self.case_task_name_line_edit)
        h_layout.addWidget(push_button)
        self.setLayout(h_layout)

    def do_push_button(self):
        DB.isRecord = True
        DB.case_task_name = self.case_task_name_line_edit.text()
        self.close()



if __name__ == '__main__':
    app = QApplication()
    win = PopupWindow()
    win.show()
    app.exec()
